package xyz.xuminghai.javafx_learn.scene.shape;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.shape.Polygon;
import javafx.stage.Stage;

/**
 * 2023/8/12 14:31 星期六<br/>
 * 创建一个由 x,y 坐标数组定义的多边形。 Polygon 类与 Polyline 类类似，只不过 Polyline 类不会自动关闭
 *
 * @author xuMingHai
 */
public class PolygonApp extends Application {

    private final BorderPane root = new BorderPane();


    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void init() {
        Polygon polygon = new Polygon(0.0, 0.0,
                100.0, 0.0,
                100.0, 100.0);
        root.setCenter(polygon);
    }

    public void start(Stage primaryStage) {
        primaryStage.setTitle(getClass().getSimpleName());
        Scene scene = new Scene(root, 800, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}
